home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / X11R4 / cmds / X / os / sprite.X11R3 / spriteos.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-09  |  4.4 KB  |  123 lines

  1. /*-
  2.  * spriteos.h --
  3.  *    Internal data for Sprite OS layer.
  4.  *
  5.  * Copyright (c) 1987 by the Regents of the University of California
  6.  *
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  *
  15.  *    "$Header: /mic/X11R3/src/cmds/Xsprite/os/sprite/RCS/spriteos.h,v 1.12 89/10/04 19:18:15 tve Exp Locker: tve $ SPRITE (Berkeley)"
  16.  */
  17. #ifndef _OS_H
  18. #define _OS_H
  19.  
  20. /*
  21.  * Because both Sprite and X define the type 'Time' (and they're incompatible),
  22.  * we have to kludge things by making the definition of Time in the Sprite
  23.  * files be SpriteTime. Henceforth, that is what the Sprite Time value should
  24.  * be referred to as.
  25.  */
  26. #include    "buf.h"
  27. #include    <list.h>
  28.  
  29. #include    "X.h"
  30. #include    "Xmd.h"
  31. #include    "os.h"
  32. #include    "dixstruct.h"
  33.  
  34. /*
  35.  * Scheduling interval. After MAX_PACKETS requests have been processed,
  36.  * the client is forced to yield the server to the next client.
  37.  */
  38. #define MAX_PACKETS    10
  39.  
  40. /*
  41.  * Various aspects of a client must be tracked to handle the protocol.
  42.  * These are stored in the ClntPrivRec hanging from the osPrivate field of
  43.  * the ClientRec.
  44.  *
  45.  * There are two distinct types of connections being used here. One is
  46.  * over a Pseudo-device where the connection is very synchronous. The
  47.  * other is over a TCP stream, as managed by the TCP module. There are
  48.  * various differences between the two, not the least of which that there
  49.  * is only one stream for the TCP connection. To embody this, each client
  50.  * has a Read and a Write function, as well as a stream-private pointer
  51.  * that is manipulated only by the controlling module. To determine when
  52.  * a client is ready, two select masks are also maintained.
  53.  */
  54. typedef struct {
  55.     char          *(*readProc)();   /* Function to read from the client */
  56.     int              (*writeProc)();   /* Function to write to the client */
  57.     void          (*closeProc)();   /* Function to close down the client */
  58.  
  59.     int              *mask;        /* Mask of all streams for this client
  60.                      * (set by the controlling module) */
  61.     int              *ready;        /* Mask of streams that are ready
  62.                      * (set by the scheduler) */
  63.     int              maskWidth;          /* Width of said masks */
  64.     pointer       devicePrivate;    /* Data private to the controlling module */
  65. } ClntPrivRec, *ClntPrivPtr;
  66.  
  67. /*
  68.  * Global data
  69.  */
  70. extern int            *AllClientsMask;        /* All active clients */
  71. extern int            *SavedAllClientsMask;   /* When grabbed */
  72. extern int            *AllStreamsMask;      /* All streams to check */
  73. extern int            *SavedAllStreamsMask;   /* When grabbed */
  74. extern int            *LastSelectMask;    /* Result of Fs_Select */
  75. extern int            *EnabledDevicesMask;    /* Mask from devices */
  76. extern int            *ClientsWithInputMask;  /* Mask of clients with input
  77.                              * still in their buffers */
  78. extern int            NumActiveStreams;       /* The number of active streams
  79.                          * used in the various bit
  80.                          * masks */
  81. #ifdef TCPCONN
  82. extern int            TCP_Conn;               /* TCP listening socket */
  83. #endif TCPCONN
  84.  
  85. extern int            Pdev_Conn;            /* New Pseudo-device control
  86.                          * stream ID */
  87.  
  88. extern char           *display;            /* Our display number */
  89. extern Bool           GrabDone;               /* TRUE if listening to only
  90.                          * one client */
  91. extern ClientPtr      grabbingClient;       /* Client that performed the
  92.                          * grab. */
  93. extern char           whichByteIsFirst;       /* Our byte order */
  94. extern List_Links    allStreams;             /* All open streams */
  95. extern int            spriteCheckInput;
  96. extern void           spriteInputAvail();
  97. extern void           ExpandMasks();
  98. extern Bool           clientsDoomed;
  99. /*
  100.  * Debug control:
  101.  *    There is one bit per module. It is up to the module what debug
  102.  *    information to print.
  103.  *    DBG(module) returns TRUE if debugging is on for that module.
  104.  */
  105. extern int            debug;
  106. #define DEBUG_SCHED    0x00000001
  107. #define DEBUG_CONN    0x00000002
  108. #define DEBUG_PDEV     0x00000004
  109. #define DEBUG_TCP     0x00000010
  110.  
  111. #define I(a)          a
  112. #ifdef __STDC__
  113. #define CONCAT(a,b)    a##b
  114. #else
  115. #define CONCAT(a,b)    I(a)b
  116. #endif /* __STDC__ */
  117. #define DBG(module)    (debug & CONCAT(DEBUG_,module))
  118.  
  119. #define FamilySprite    3       /* Pseudo-device access control -- should
  120.                  * be in X.h */
  121.  
  122. #endif _OS_H
  123.